﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="DataSourceSelect.ascx.cs"
    Inherits="UserControls_DataSourceSelect" %>
<table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#DADADA">
    <tr>
        <td class="form_tdText">选择数据源</td>
    </tr>
    <tr>
        <td class="form_tdText">
            <asp:DropDownList ID="ddlColumn" runat="server" Style="font-size: 12px;" AutoPostBack="true"
                OnSelectedIndexChanged="ddlColumn_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:Label ID="lbColumnID" runat="server" ForeColor="red"></asp:Label>
            <asp:HiddenField ID="hfTable" runat="server" />
        </td>
    </tr>
    <tr>
        <td class="form_tdText">
            <asp:CheckBoxList ID="cblField" runat="server">
            </asp:CheckBoxList>
        </td>
    </tr>
</table>

<script language="javascript">
<!--
function checkSelect()
{
    var ddl = document.getElementById("DataSourceSelect1$ddlColumn");
    
    if(ddl != null)
    {
        var len = ddl.options.length;
        for(var i=0;i<len;i++)
        {
            if(!ddl.options[i].selected)
                continue;
            
            if(ddl.options[i].value == "0" || ddl.options[i].style.color != "")
            {
                alert("请选择黑色字体栏目!");
                
                //还原
                var lbv = document.getElementById("DataSourceSelect1_lbColumnID").innerText;
                if(lbv == "")
                    ddl.options[0].selected = true;
                else
                {
                    var cid = lbv.substring(lbv.indexOf('=')+1, lbv.length);
                    for(var j=1;j<len;j++)
                    {
                        if(ddl.options[j].value == cid)
                        {
                            ddl.options[j].selected = true;
                            return false;
                        }
                    }
                }
                
                return false;
            }
            else
                return true;
        }
    }
    
    return true;
}
//-->
</script>

